Fix remaining preload tests flaking on wpt.fyi This is a follow-up to https://github.com/web-platform-tests/wpt/pull/15075. https://crrev.com/c/1436777 successfully fixed the wpt.fyi flakiness for link-header-preload-srcset.tentative.html and link-header-preload-nonce.html. This patch fixes that for the remaining preload tests. - Use step_timeout instead of dummy.js?pipe=trickle, because dummy.js?pipe=trickle may be loaded from cache with no delay. - Replace verifyNumberOfDownloads() with - verifyNumberOfResourceTimingEntries() if possible - A new helper function verifyLoadedAndNoDoubleDownload() that doesn't fail if the resource was already cached before running the test. Bug: 922343 Change-Id: Ia9b7c4bd49dd76463df4607349fe4f935e5410d0 Reviewed-on: https://chromium-review.googlesource.com/c/1442020 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#629029} diff --git a/preload/link-header-on-subresource.html b/preload/link-header-on-subresource.html index a02bc7c..087a342 100644 --- a/preload/link-header-on-subresource.html +++ b/preload/link-header-on-subresource.html
@@ -6,12 +6,13 @@ var t = async_test('Makes sure that Link headers on subresources preload resources'); </script> <link rel=stylesheet href="resources/dummy-preloads-subresource.css?link-header-on-subresource"> -<script src="resources/dummy.js?pipe=trickle(d5)&link-header-on-subresources"></script> <script> window.addEventListener("load", t.step_func(function() { - verifyPreloadAndRTSupport(); - verifyNumberOfDownloads("/fonts/CanvasTest.ttf?link-header-on-subresource", 1); - t.done(); + t.step_timeout(function() { + verifyPreloadAndRTSupport(); + verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf?link-header-on-subresource", 1); + t.done(); + }, 5000); })); </script>